#include <iostream>
using namespace std;

#include "widgetlienzogtkmm.h"

int
main (int argc, char **argv)
{
	Gtk::Main app (argc, argv);
	
	xmlref_t refXml; // Para leer el fichero de glade
	
	WidgetLienzogtkmm* wl = NULL; // El objeto que representa el canvas
	
	Gtk::Window* pDialog = NULL; // El dialogo que es la ventana ppal.
	
	Gtk::MenuItem* MCerrar;
			
	try
	{
		refXml = Gnome::Glade::Xml::create ("./ui/vista_gtkmm.glade");
	}
	
	catch(const Gnome::Glade::XmlError& ex)
	{
		std::cerr << ex.what() << std::endl;
		
		return 1;
	}
	
	refXml -> get_widget("gtkmmPaint", pDialog);
	
	if (pDialog)
	{
		wl = new WidgetLienzogtkmm(refXml);
		
		refXml->get_widget("menuSalir", MCerrar);
		
		MCerrar->signal_activate().connect(sigc::mem_fun(*pDialog, &Gtk::Dialog::hide));		
		
		app.run(*pDialog);
		
		delete wl;
		
		delete pDialog;
	}
	
	return 0;
}
